﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace assignment2_secondTry
{
    public partial class Form1 : Form
    {

        bool defaultLanguage = true;

        public Form1()
        {
            InitializeComponent();
        }

        private void btnChangeLang_Click(object sender, EventArgs e)
        {

            if (defaultLanguage)
            {
                ChangeLanguage("no");
                defaultLanguage = false;
            }
            else
            {
                ChangeLanguage("en-US");
                defaultLanguage = true;
            }
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources =
                      new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }

            
        }

        private void btnChangeIcon_Click(object sender, EventArgs e)
        {
            if (this.Icon == Properties.Resources.Icon1)
            {
                this.Icon = Properties.Resources.Icon2;
            }
            else
            {
                this.Icon = Properties.Resources.Icon1;
            }
            this.Update();
        }

        private void btnClass1_Click(object sender, EventArgs e)
        {

            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0]+", "+numbers[1]+", "+numbers[2];

        }

        private void btnNewForm_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();
            f.Show();
        }

        private void btnResetIcon_Click(object sender, EventArgs e)
        {

        }

    }
}
